package main

import (
	"context"
	"fmt"
	pb "gitee.com/jinmingzhi/rest_test/api"
	"github.com/golang/protobuf/ptypes"
	"github.com/golang/protobuf/ptypes/empty"
)

var hobby = []string{"box"}

type Public struct{}

func (p *Public) Set(ctx context.Context, req *pb.SetReq) (*empty.Empty, error) {
	fmt.Println(req.Name)
	fmt.Println(req.Gender)
	hobby = req.Hobbies
	return &empty.Empty{}, nil
}
func (p *Public) GetHobbyByname(ctx context.Context, req *pb.GetHobbyBynameReq) (*pb.GetHobbyBynameResp, error) {
	fmt.Printf(req.Name)
	return &pb.GetHobbyBynameResp{
		Hobbies: hobby,
		Time:    ptypes.TimestampNow(),
	}, nil
}
